﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework.Input;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace titan
{
    class HMouse
    {
        private Vector2 location;
        public float X
        {
            get { return location.X; }
        }
        public float Y
        {
            get { return location.Y; }
        }
        protected string[] textures_names;
        private Texture2D[] texture;
        private int current_texture;


        public HMouse()
        {
            this.textures_names = new string[1];
            this.textures_names[0] = Constants.STR_CURSOR_GAUNTLET;
            current_texture = 0;
        }

        public void LoadContent(ContentManager content)
        {
            int count = 0;
            this.texture = new Texture2D[textures_names.Length];
            foreach (string s in textures_names)
            {
                this.texture[count] = content.Load<Texture2D>(s);
                count++;
            }
        }

        public void Update()
        {
            MouseState mouseState = Mouse.GetState();
            this.location = new Vector2(mouseState.X, mouseState.Y);
        }

        public bool isLeftClicked()
        {
            MouseState mouseState = Mouse.GetState();
            if (mouseState.LeftButton == ButtonState.Pressed)
                return true;
            else
                return false;
        }

        public bool isRightClicked()
        {
            MouseState mouseState = Mouse.GetState();
            if (mouseState.RightButton == ButtonState.Pressed)
                return true;
            else
                return false;
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(this.texture[current_texture], this.location, Color.White);
        }
    }
}
